import axios from 'axios'

let baseUrl = process.env.NODE_ENV=="production"?process.env.VUE_APP_SERVER_URL:"/api";
const URLS = {
    USER_LIST:"http://127.0.0.1:3000/user/list",
    CORS_LIST:baseUrl+"/cors/list"
}

const loadUserList = function() {
    // let p = axios.get(URLS.USER_LIST)
    // return p;
    return axios.get(URLS.USER_LIST)
               .then(function(response){
                    return response.data
               })
}
const loadCorsList = function() {
    return axios.get(URLS.CORS_LIST)
               .then(function(response){
                    return response.data
               })
}

// export default {
//     loadUserList,
// }
export default {
    install(Vue){
        Vue.prototype.$api = {
            loadUserList,loadCorsList
        }
    }
}